<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理员登录</title>
    <script src="../js/vue.js"></script>
    <script src="../element-ui/lib/index.js"></script>
    <link rel="stylesheet" href="../element-ui/lib/theme-chalk/index.css">
    <script src="../js/axios-0.18.0.js"></script>

    <style>
        body {
            font-family: Arial, sans-serif;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            background-color: #f4f4f4;
        }
        .login-container {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 300px;
            text-align: center;
        }
        .login-container input[type="text"],
        .login-container input[type="password"] {
            width: calc(100% - 22px);
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 4px;
        }
        .login-container input[type="button"] {
            width: 100%;
            padding: 10px;
            background-color: #007BFF;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }
        .login-container input[type="submit"]:hover {
            background-color: #0056b3;
        }
    </style>
</head>
<body>
<div  id="app">
    <div class="login-container">
        <h2>登录</h2>
        <form>
            <input type="text" name="accountNum" placeholder="用户名" v-model="doctor.accountNum" required>
            <input type="password" name="pwd" placeholder="密码" v-model="doctor.pwd" required>
            <input type="button" value="登录" @click="login">
        </form>
    </div>

</div>

<script>
    new Vue({
        el:"#app",
        data() {
            return {
                doctor:{
                    accountNum:'',
                    pwd:''
                }

            }
        },
        methods:{
            login(){
                axios.post("http://localhost:8080/doctors/login",this.doctor).then(resp=>{
                    if(resp.data.code===20040){
                        this.$message.error("用户名或密码错误");
                    }else{
                        window.location.href='doctorFrame.html';
                    }
                })
            }
        }
    })
</script>


</body>
</html>